/**
 * Created by Administrator on 2017-06-14.
 */
var driving = {
    init : function(){
        this.chartMillage();
        this.chartDriving();
    },

    chartMillage : function(){
        var option = {

            tooltip : {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            legend: {
                data:['行驶里程']
            },
            grid: {
                /*left: '3%',
                right: '4%',
                bottom: '3%',*/
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    boundaryGap : false,
                    data : ['周一','周二','周三','周四','周五','周六','周日']
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'行驶里程',
                    type:'line',
                    stack: '总里程',
                    data:[120, 132, 101, 134, 90, 230, 210]
                }
            ]
        };
        var myChart = echarts.init(document.getElementById('chartMillage'));
        myChart.setOption(option);
        window.onresize = myChart.resize;
    },

    chartDriving : function(){
        var option = {
            tooltip : {
                trigger: 'axis'
            },
            legend: {
                data:['超速','疲劳驾驶','进出区域','线路偏移','进出地点','其它报警']
            },

            calculable : true,
            xAxis : [
                {
                    type : 'category',
                    data : ['1','2','3','4','5','6','7','8','9','10']
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'超速',
                    type:'bar',
                    data:[2, 4, 7, 23, 25, 76, 135, 162, 32, 20]
                },
                {
                    name:'疲劳驾驶',
                    type:'bar',
                    data:[2, 5, 9, 26, 28, 70, 175, 182, 48, 18]
                },
                {
                    name:'进出区域',
                    type:'bar',
                    data:[2, 5, 9, 26, 28, 70, 175, 182, 48, 18]
                },
                {
                    name:'线路偏移',
                    type:'bar',
                    data:[2, 5, 9, 26, 28, 70, 175, 182, 48, 18]
                },
                {
                    name:'进出地点',
                    type:'bar',
                    data:[2, 5, 9, 26, 28, 70, 175, 182, 48, 18,]
                },
                {
                    name:'其它报警',
                    type:'bar',
                    data:[2, 5, 9, 26, 28, 70, 175, 182, 48, 18]
                }
            ]
        };
        var myChart = echarts.init(document.getElementById('chartDriving'));
        myChart.setOption(option);
        window.onresize = myChart.resize;
    }
};

driving.init();